package com.lichuang.fruitvarietysm.cart.service.impl;

import com.lichuang.fruitvarietysm.cart.entity.Shoppingcart;
import com.lichuang.fruitvarietysm.cart.mapper.ShoppingcartMapper;
import com.lichuang.fruitvarietysm.cart.service.IShoppingcartService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author kangkang
 * @since 2019-06-10
 */
@Service
public class ShoppingcartServiceImpl extends ServiceImpl<ShoppingcartMapper, Shoppingcart> implements IShoppingcartService {

    @Autowired
    ShoppingcartMapper shoppingcartMapper;

    @Override
    public int sCartYesOrNoGoods(int userId, int goodsId) {
        return shoppingcartMapper.sCartYesOrNoGoods(userId,goodsId);
    }

    @Override
    public Shoppingcart sCartGoodsNumber(int userId, int goodsId) {
        return shoppingcartMapper.sCartGoodsNumber(userId,goodsId);
    }

    @Override
    public int sGoodsMiaoSha(int goodsId) {
        return shoppingcartMapper.sGoodsMiaoSha(goodsId);
    }

    @Override
    public int addCart(int userId, int goodsId,String createTime,BigDecimal totalPrice,Integer skuId) {
        return shoppingcartMapper.addCart(userId,goodsId,createTime,totalPrice,skuId);
    }

    @Override
    public int updateCatNum(int cartID,int quantity) {
        return shoppingcartMapper.updateCatNum(cartID,quantity);
    }

    @Override
    public int deleteCatGoods(int cartID) {
        return shoppingcartMapper.deleteCatGoods(cartID);
    }

}
